from manim import *

class polygon(Scene):
   def construct(self):
        # 等腰三角形
        poly_triangl = Polygon(
            [5,1,0],
            [1,1,0],
            [3,3,0],
        )
        self.add(poly_triangl)

        # 四边形
        points=[
            [0,0,0],
            [0,2,0],
            [-2,2,0],
            [-2,0,0],
        ]
        polygon_quad = Polygon(
            *points,
            fill_color=GREEN,
            fill_opacity=0.5,
            stroke_color=WHITE,
            stroke_width=2,
        )
        self.play(Create(polygon_quad))
        self.wait()
        
class polygon_2d(Scene):
    def construct(self):
        # 等腰三角形 --> NG, 不支持2d 坐标
        poly_triangl = Polygon(
            [5,1],
            [1,1],
            [3,3],
        )
        self.add(poly_triangl)